<?php 
/**
 * Main layout template page.
 *
 * @package   views
 * @subpackage layouts
 * @since     1.0
 * @filesource
 */

// set height handler to resize height when the page is too small
// to make the footer always cover the bottom of the page.
Yii::app()->clientScript->registerScript('setPageHeight',<<<EOF
(function($){
	var resize=function(){
		var windowHeight=$(window).height();
		var otherHeight=$('#header-navigation').height()+
			$('#breadcrumbs-container').height()+
			$('#footer').height();
		var contentContainer=$('#content-container');
		contentContainer.css('height','');
		var contentHeight=contentContainer.height();
		if((windowHeight-otherHeight>=contentHeight)){
			contentContainer.css('height',windowHeight-otherHeight);
		}
	}
	resize();
	window.setInterval(resize, 500);
})(jQuery);


EOF
);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />

	<!-- blueprint CSS framework -->
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
	<!--[if lt IE 8]>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />
	<![endif]-->

	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/neural.css" />

	<title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>

<body>

<div id="page">
	<div id="header-navigation"><div id="header-navigation-overlay"><div id="header-navigation-overlay2">
		
		<div id="header">
			<div class="container">
				<div id="header-shadow-left"><div id="header-shadow-right">
				<div id="logo"><?php echo CHtml::image(Yii::app()->baseUrl.'/images/logo.png',CHtml::encode(Yii::app()->name)); ?></div>			
				</div></div>
			</div>
		</div><!-- header -->
		<div id="navigation">
			<div id="mainmenu-overlay-r">
			<div id="mainmenu-overlay-l">
				<div class="container">
					<div id="mainmenu">
					<?php $this->widget('zii.widgets.CMenu',array(
						'items'=>array(
							array('label'=>GlobalConfiguration::getByKey("HOME_TEXT"), 'url'=>GlobalConfiguration::getByKey("HOME_LINK")),
							array('label'=>'Home', 'url'=>array('/site/index')),
							array('label'=>'Signals', 'url'=>array('/patientSignal/index'), 'visible'=>!Yii::app()->user->isGuest),
							array('label'=>'Upload Signal', 'url'=>array('/patientSignal/upload'), 'visible'=>!Yii::app()->user->isGuest),
							
							array('label'=>'Administration', 'visible'=>Yii::app()->user->checkAccess('admin'),
							'items'=>array(
								array('label'=>'User', 'url'=>array('/user'), 'visible'=>Yii::app()->user->checkAccess('admin')),
								array('label'=>'Organization', 'url'=>array('/organization'), 'visible'=>Yii::app()->user->checkAccess('admin')),
								array('label'=>'Disorder', 'url'=>array('/disorder'), 'visible'=>Yii::app()->user->checkAccess('admin')),
								array('label'=>'Global Configuration', 'url'=>array('/globalConfiguration'), 'visible'=>Yii::app()->user->checkAccess('admin')),
								)
							),				
							
							array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
							array('label'=>'Change Password', 'url'=>array('/user/changePassword'), 'visible'=>!Yii::app()->user->isGuest),
							array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest),
						),
					)); ?>
					<div class="clear"></div>
					</div><!-- mainmenu -->
				</div>
			</div>
			</div>
		</div>
	</div></div></div>
	<div id="body-container" class="container">
	<div id="body-shadow-right"><div id="body-shadow-left">
		<div id="breadcrumbs-container">			
			<?php $this->widget('zii.widgets.CBreadcrumbs', array(
				'links'=>$this->breadcrumbs,
			)); ?><!-- breadcrumbs -->
		</div>
		<?php echo $content; ?>
	</div></div>
	</div>
	<div id="footer">
		<div class="container">
		Copyright &copy; <?php echo date('Y'); ?> by Neural Diagnostics.<br/>
		All Rights Reserved.<br/>
		</div>
	</div><!-- footer -->
</div><!-- page -->
</body>
</html>